#ifndef AUDIOSWITCHER_H
#define AUDIOSWITCHER_H

#include <QObject>
#include <QtCore/QMap>
#include <QtCore/QString>

#include <stdio.h>
#include <wchar.h>
#include <tchar.h>
#include "windows.h"
#include "Mmdeviceapi.h"
#include "PolicyConfig.h"
#include "Propidl.h"
#include "Functiondiscoverykeys_devpkey.h"

class AudioSwitcher : public QObject
{
	Q_OBJECT

public:
	AudioSwitcher(QObject *parent=0);
	~AudioSwitcher();

	QMap<QString, QString> GetAudioPlaybackDevices();
	QString GetDefaultAudioEndpoint(ERole role = eConsole);
	HRESULT SetDefaultAudioPlaybackDevice(QString devID, ERole role = eConsole);
	void SetDefaultAudioPlaybackDevice(int index, ERole role = eConsole);
	QString GetDeviceName(QString wstrID);
	HRESULT SetDefaultNextAudioPlaybackDevice(ERole role = eConsole);

private:
	QString GetDeviceName(IMMDevice *pDevice);
	QMap<QString, QString> EnumAudioPlaybackDevice(int multimedia=-1,int communications=-1);
	HRESULT SetDefaultAudioPlaybackDevice(LPCWSTR devID, ERole role = eConsole);
};

#endif // AUDIOSWITCHER_H
